package com.project.restaurant.meal.controller;

import com.project.restaurant.common.api.ResponseResult;
import com.project.restaurant.common.api.ServiceReturn;
import com.project.restaurant.meal.service.MealMenuService;
import com.project.restaurant.meal.vo.MealMenuVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(value = "菜单接口",tags = "菜单接口")
@RestController
@RequestMapping("/meal/menu")
public class MealMenuController {

    @Autowired
    MealMenuService menuService;

    @ApiOperation(value = "获取菜单",notes = "")
    @ApiResponse(code = 200, message = "操作成功", response = MealMenuVo.class,responseContainer = "List")
    @GetMapping("")
    public ResponseResult<List<MealMenuVo>> obtainMenu(){
        ServiceReturn<List<MealMenuVo>> result = menuService.generateMenu();
        return ResponseResult.auto(result.getStateCode(),result.getReturnData());
    }
}
